
<%@ page import="pc.system.*,wstrader.*,wstrader.task.*" %>

<%
    Users user = Trader.getUser(request.getParameter("uid"));
	
	if (user == null || !user.Authenticated()) {
		response.sendRedirect("logon.jsp");	
		return;
	}
	wstrader.task.trade.Allocation ftask = user.trade.allocation;
	wstrader.task.trade.allocation.Contract task = user.trade.allocation.contract;
	((Tasks)ftask.getOwner()).clearFocus();
	ftask.setFocus(true);
	Trader.window_width = "75%";
	
%>
	

<%
	long focused_id = task.doTask();
	if (focused_id <= 0) focused_id = 1;

	String view = request.getParameter("view");
	String contracts = request.getParameter("contracts");

	if (view==null) view ="0";
	if (contracts==null) contracts ="0";
	ResultSet rs;
%>

<%@include file="../header.jsp"%>

<link href="style.css" rel="stylesheet" type="text/css">

<style type="text/css">
<!--
.style3 {font-weight: bold}
-->
</style>

<script language="javascript">
function ajaxTable( page )
{

var xmlHttp;
var form = document.formMain;
//form.itemidajax.value = form.itemid.value;

//page = page + "?itemid="+form.itemid.value;
try
  {  
  		xmlHttp=new XMLHttpRequest();  
  }
	catch (e)
  	{  // Internet Explorer  
  	try
    {    
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
	}
  	catch (e)
    {    
		try
      	{      
	  		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
	  	}
    	catch (e)
      	{      
	  		alert("Your browser does not support AJAX!");      
			return false;      
	  	}    
	 }  
	}
  		xmlHttp.onreadystatechange=function()
    {
		
    	if(xmlHttp.readyState==4)
      	{
      		document.getElementById("AjTbl").innerHTML=xmlHttp.responseText;
      	}
    }

  xmlHttp.open("GET",page,true);
  xmlHttp.send(null);  
  }
</script>


<form method="POST" name="formMain" action="" onSubmit="">				  
<table width="100%" border="0" class="style2">
	<tr>
	  <td valign="middle">	    	    <img src="images/allocation.jpg" width="250" height="30"> </td>
	</tr>
	<tr><td height="468" valign="top">
    <table width="100%" height="466" border="1" cellpadding="0" cellspacing="0" class="style2">
      <tr valign="top">
	  <td width="200" height="464"><table width="100%">
	  	<tr><td align="center" bgcolor="#EEEEEE" class="style1">Contracts</td>
	  	</tr>
	  	<tr><td height="412" valign="top">
	  		<select name="contracts" size="27" class="style2" id="contracts" style="width:112px; border:0" onChange="ajaxTable('trade.allocation.alctable.jsp?uid=<%=request.getParameter("uid")%>')">
				<%
					task.getResponse().setOption(task.getConditionalList("ref_number","type","S","contracts"));
					task.getResponse().setSelected("contracts",focused_id);
				%>
     		</select>
	  	</td></tr>
		<tr><td height="23" align="left" valign="bottom">&nbsp;</td>
		</tr>
	  </table></td>
        <td width="100%" align="top" ><table width="100%"><tr><td id="AjTbl">

</td></tr>
<tr>
	<td class="style3">&nbsp;</td>
</tr>
<tr>
<td align="right">&nbsp;</td>
</tr>
</table>
		
		</td>
      </tr>
  </table>
</td></tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
    <tr><td align="right">&nbsp;&nbsp;&nbsp;</td>
    </tr>
</table>  
	<span class="style3"><input type="hidden" name="uid"        id="uid"       value="<%=user.getuid()%>">		
    <input type="hidden" name="task_id"    id = "task_id"   value="0">
  </span>
</form>

<div align="left"><span class="style3">
  <%
	//rc.close();
%>
  <%@include file="../footer.jsp"%>
  
  </span>
  
</div>
